package
{
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.Sprite;

	public class Slot25Canvas extends Slot25Standard
	{
		private var _sprite:Sprite;

		public function Slot25Canvas(r:* = null)
		{
			super(r);
			_sprite = new Sprite();
		}

		public function get tables():Vector.<Slot25Table>
		{
			return main.tables;
		}

		public function get sprite():Sprite
		{
			return _sprite;
		}

		public function removeChild(child:DisplayObject):void
		{
			if (child == null || child.parent != sprite)
			{
				return;
			}
			sprite.removeChild(child);
		}

		public function addChild(child:DisplayObject):void
		{
			sprite.addChild(child);
		}

		public function addChildAt(child:DisplayObject, index:int):void
		{
			sprite.addChildAt(child, index);
			sprite.visible
		}

		public function setTableVisible(visible:Boolean):void
		{
			for each (var table:Slot25Table in tables)
			{
				if (visible)
				{
					table.enable();
				}
				else
				{
					table.disable();
				}
			}
		}

		public function setTablePopup(index:int):void
		{
			setTableVisible(false);
			var table:Slot25Table = tables[index];
			table.enable();
		}

		public function setChildIndex(child:DisplayObject, index:int = -1):void
		{
			if (index == -1)
			{
				index = sprite.numChildren - 1;
			}
			sprite.setChildIndex(child, index);
		}
	/*public function clear():void
	{
		while (sprite.numChildren > 0)
		{
			var child:DisplayObject = sprite.getChildAt(0);
			sprite.removeChild(child);
			child = null;
		}
	}*/
	}
}
